package com.qst.action.question;

import com.qst.BaseServlet;
import com.qst.RequestUtil;
import com.qst.WebUtil;
import com.qst.entity.AssessmentType;
import com.qst.entity.Choice;
import com.qst.entity.PersonalityDimension;
import com.qst.entity.Question;
import com.qst.service.AssessmentService;
import com.qst.service.QuestionService;
import com.qst.service.impl.ServiceFactory;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

//@WebServlet("/question/view.action")
public class ViewServlet extends BaseServlet {
    private AssessmentService assessmentService = ServiceFactory.getService(AssessmentService.class);
    private QuestionService questionService = ServiceFactory.getService(QuestionService.class);

    @Override
    protected void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        Question question = questionService.findById(RequestUtil.getInt(req, "id"));
//        List<Choice> choices = questionService.findChoices(question.getId());
//        AssessmentType assessment = assessmentService.findAssessmentById(question.getAssessmentId());
//        List<PersonalityDimension> dimension = questionService.findDimensionByQuestion(question.getId());
//        req.setAttribute("assessment", assessment);
//        req.setAttribute("question", question);
//        req.setAttribute("choices", choices);
//        req.setAttribute("dimension", dimension);
//
//        WebUtil.forward(req, resp, "/question/view.jsp");
    }
}
